#include <iostream>
#include <sstream>
#include <string>
#include <fstream>

using std::cout;
using std::endl;
using std::istringstream;
using std::string;
using std::ifstream;

void readConf(const string &filename)
{
    ifstream ifs(filename);
    if(!ifs.good())
    {
        std::cerr << "open file " << filename << " error!" << endl;
        return ;
    }

    string line;
    while(getline(ifs, line))
    {
        istringstream iss(line);
        string key, value;
        while(iss >> key >> value)
        {
            cout << key << "    "<< value << endl;
        }
    }

    ifs.close();
}

void test(const string &filename)
{
    ifstream ifs(filename);
    if(!ifs.good())
    {
        std::cerr << "open file " << filename << " error!" << endl;
        return ;
    }

    string key, value;
    while(ifs >> key >> value)
    {
        cout << key << "    "<< value << endl;
    }

    ifs.close();
}

int main(int argc, char *argv[])
{
    readConf("my.conf");
    /* test("my.conf"); */
    
    return 0;
}

